using ETask.Api.Dtos;
using ETask.Api.Models;

namespace ETask.Api.Services
{
    /// <summary>
    /// 审计日志服务接口
    /// </summary>
    public interface IAuditLogService : IGenericService<AuditLog,AuditLogDto,CreateAuditLogDto,UpdateAuditLogDto>
    {
        /// <summary>
        /// 分页查询审计日志
        /// </summary>
        /// <param name="queryParams">查询参数</param>
        /// <returns>分页结果</returns>
        Task<PagedResult<AuditLogDto>> GetPagedListAsync(AuditLogQueryParams queryParams);

        /// <summary>
        /// 根据用户ID获取最近的日志
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="count">数量</param>
        /// <returns>日志列表</returns>
        Task<List<AuditLogDto>> GetRecentLogsByUserIdAsync(int userId, int count = 10);

        /// <summary>
        /// 记录审计日志
        /// </summary>
        /// <param name="logDto">日志信息</param>
        /// <param name="userId">操作者用户ID</param>
        /// <param name="userName">操作者用户名</param>
        /// <param name="userRealName">操作者真实姓名</param>
        /// <param name="clientIp">客户端IP</param>
        /// <param name="userAgent">用户代理</param>
        Task LogAsync(CreateAuditLogDto logDto, int userId, string userName, string userRealName, string? clientIp = null, string? userAgent = null);

        /// <summary>
        /// 记录成功操作日志
        /// </summary>
        Task LogSuccessAsync(string actionType, string module, string description, int? targetId = null, string? targetName = null, string? oldValues = null, string? newValues = null);

        /// <summary>
        /// 记录失败操作日志
        /// </summary>
        Task LogErrorAsync(string actionType, string module, string description, string errorMessage, int? targetId = null, string? targetName = null);
    }
}
